package com.ruoyi.testDeal.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.testDeal.domain.equInfo.JkFzqInfo;
import com.ruoyi.testDeal.service.IJkFzqInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 非煤防坠器信息Controller
 *
 * @author ruoyi
 * @date 2024-04-09
 */
@RestController
@RequestMapping("/testDeal/jkFzqInfo")
public class JkFzqInfoController extends BaseController
{
    @Autowired
    private IJkFzqInfoService jkFzqInfoService;

    /**
     * 查询非煤防坠器信息列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkFzqInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(JkFzqInfo jkFzqInfo)
    {
        startPage();
        List<JkFzqInfo> list = jkFzqInfoService.selectJkFzqInfoList(jkFzqInfo);
        return getDataTable(list);
    }

    /**
     * 导出非煤防坠器信息列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkFzqInfo:export')")
    @Log(title = "非煤防坠器信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JkFzqInfo jkFzqInfo)
    {
        List<JkFzqInfo> list = jkFzqInfoService.selectJkFzqInfoList(jkFzqInfo);
        ExcelUtil<JkFzqInfo> util = new ExcelUtil<JkFzqInfo>(JkFzqInfo.class);
        util.exportExcel(response, list, "非煤防坠器信息数据");
    }

    /**
     * 获取非煤防坠器信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkFzqInfo:query')")
    @GetMapping(value = "/{jkFzqid}")
    public AjaxResult getInfo(@PathVariable("jkFzqid") Long jkFzqid)
    {
        return success(jkFzqInfoService.selectJkFzqInfoByJkFzqid(jkFzqid));
    }

    /**
     * 新增非煤防坠器信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkFzqInfo:add')")
    @Log(title = "非煤防坠器信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JkFzqInfo jkFzqInfo)
    {
        return toAjax(jkFzqInfoService.insertJkFzqInfo(jkFzqInfo));
    }

    /**
     * 修改非煤防坠器信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkFzqInfo:edit')")
    @Log(title = "非煤防坠器信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JkFzqInfo jkFzqInfo)
    {
        return toAjax(jkFzqInfoService.updateJkFzqInfo(jkFzqInfo));
    }

    /**
     * 删除非煤防坠器信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkFzqInfo:remove')")
    @Log(title = "非煤防坠器信息", businessType = BusinessType.DELETE)
    @DeleteMapping("/{jkFzqids}")
    public AjaxResult remove(@PathVariable Long[] jkFzqids)
    {
        return toAjax(jkFzqInfoService.deleteJkFzqInfoByJkFzqids(jkFzqids));
    }
}
